Skip to content

refactor(agent): extract package broker into dedicated crate - #1927

Open
Vladyslav Nikonov (vnikonov-devolutions) wants to merge 9 commits into
masterfrom
vnikonov-devolutions-dgw-417-extract-package-broker-crate
Open

refactor(agent): extract package broker into dedicated crate#1927
Vladyslav Nikonov (vnikonov-devolutions) wants to merge 9 commits into
masterfrom
vnikonov-devolutions-dgw-417-extract-package-broker-crate

Conversation

@vnikonov-devolutions

Copy link
Copy Markdown
Contributor

Move the package broker subsystem out of the devolutions-agent binary into a new crates/now-package-broker crate, keeping the agent manifest lean and giving the broker-only dependency set (axum, hyper-util, notify, now-policy, ...) its own home. The crate compiles to an empty library on non-Windows platforms.

Extract code_signing into devolutions-agent-shared so it is shared between the updater and the broker, which previously reached back into the agent crate for it. The agent forwards the development-only dev-skip-broker-signature feature to the broker crate.

Issue: DGW-417

Move the package broker subsystem out of the devolutions-agent binary
into a new crates/now-package-broker crate, keeping the agent manifest
lean and giving the broker-only dependency set (axum, hyper-util,
notify, now-policy, ...) its own home. The crate compiles to an empty
library on non-Windows platforms.

Extract code_signing into devolutions-agent-shared so it is shared
between the updater and the broker, which previously reached back into
the agent crate for it. The agent forwards the development-only
dev-skip-broker-signature feature to the broker crate.

Issue: DGW-417

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 11, 2026 11:31
@github-actions

Copy link
Copy Markdown

Let maintainers know that an action is required on their side

  • Add the label release-required Please cut a new release (Devolutions Gateway, Devolutions Agent, Jetsocat, PowerShell module) when you request a maintainer to cut a new release (Devolutions Gateway, Devolutions Agent, Jetsocat, PowerShell module)

  • Add the label release-blocker Follow-up is required before cutting a new release if a follow-up is required before cutting a new release

  • Add the label publish-required Please publish libraries (`Devolutions.Gateway.Utils`, OpenAPI clients, etc) when you request a maintainer to publish libraries (Devolutions.Gateway.Utils, OpenAPI clients, etc.)

  • Add the label publish-blocker Follow-up is required before publishing libraries if a follow-up is required before publishing libraries

@vnikonov-devolutions

Copy link
Copy Markdown
Contributor Author

Implementation notes:

  • New crate crates/now-package-broker: all of devolutions-agent/src/broker/* moved verbatim (git renames), mod.rs became lib.rs. Modules are #[cfg(windows)]-gated at the crate root and all dependencies sit under [target.'cfg(windows)'.dependencies], so the crate compiles to an empty library on other platforms (matches the previous #[cfg(windows)] pub mod broker; gating). The now-dead non-Windows fallback in pipe.rs was removed and the inner windows_pipe wrapper module flattened.
  • code_signing moved to devolutions-agent-shared::windows::code_signing: consumed by both the updater (certificate_sha1_thumbprint, is_devolutions_certificate_thumbprint) and the broker (validate_devolutions_authenticode_signature). Error messages were generalized from "client executable" to "executable" since the module is no longer broker-specific. This adds Windows-only anyhow/hex/win-api-wrappers/windows deps to the shared crate.
  • Feature forwarding: devolutions-agent's dev-skip-broker-signature feature now forwards to now-package-broker/dev-skip-broker-signature; the config-file gating logic in service.rs is unchanged. Verified cargo check -p devolutions-agent --features dev-skip-broker-signature builds.
  • Agent manifest slimming: removed broker-only deps (axum, hyper, hyper-util, tower-service, notify, now-policy{,-api,-server-template}, serde_yaml, semver, regex, chrono, tokio-util, widestring) and the broker-only windows features (Com, Console, IO, Ioctl, Pipes, UI_Shell).
  • Assets: sample policies moved to crates/now-package-broker/src/assets/; .gitattributes linguist rule updated.
  • Testing: cargo clippy --workspace --tests -- -D warnings clean; broker tests (250), agent-shared tests (26, incl. code_signing), and full cargo test --workspace pass on Windows.

Note

LLM-assisted content (no human feedback).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extracts the Windows package broker into a dedicated crate and moves shared Authenticode validation into devolutions-agent-shared.

Changes:

  • Introduces now-package-broker with broker logic, dependencies, tests, and assets.
  • Rewires the agent service and development feature forwarding.
  • Shares code-signing utilities between the broker and updater.

Reviewed changes

Copilot reviewed 25 out of 55 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
.gitattributes Updates generated-asset path.
Cargo.lock Registers the new crate and dependencies.
devolutions-agent/Cargo.toml Replaces broker dependencies with the new crate.
devolutions-agent/src/broker/mod.rs Removes the embedded broker module.
devolutions-agent/src/broker/pipe.rs Removes the embedded pipe transport.
devolutions-agent/src/lib.rs Removes broker and code-signing modules.
devolutions-agent/src/service.rs Starts the extracted broker crate.
devolutions-agent/src/updater/package.rs Uses shared code-signing helpers.
crates/devolutions-agent-shared/Cargo.toml Adds Windows code-signing dependencies.
crates/devolutions-agent-shared/src/windows/mod.rs Exports code-signing utilities.
crates/devolutions-agent-shared/src/windows/code_signing.rs Provides shared Authenticode validation.
crates/now-package-broker/Cargo.toml Defines the broker crate and feature set.
crates/now-package-broker/src/lib.rs Defines the Windows-only public modules.
crates/now-package-broker/src/auth.rs Authenticates named-pipe clients.
crates/now-package-broker/src/task.rs Implements broker lifecycle management.
crates/now-package-broker/src/pipe.rs Hosts the Windows named-pipe server.
crates/now-package-broker/src/policy_loader.rs Loads and validates policies.
crates/now-package-broker/src/policy_watcher.rs Hot-reloads policy files.
crates/now-package-broker/src/operation_tracker.rs Tracks broker operations.
crates/now-package-broker/src/scenario_tests.rs Updates sample-asset lookup.
crates/now-package-broker/src/server/mod.rs Implements broker API behavior.
crates/now-package-broker/src/server/connection.rs Serves HTTP connections.
crates/now-package-broker/src/server/execution.rs Runs asynchronous operations.
crates/now-package-broker/src/server/responses.rs Builds broker responses and capabilities.
crates/now-package-broker/src/executor/mod.rs Defines executor abstractions.
crates/now-package-broker/src/executor/output.rs Captures output and describes exit codes.
crates/now-package-broker/src/executor/windows/mod.rs Implements Windows execution.
crates/now-package-broker/src/executor/windows/process.rs Creates and supervises processes.
crates/now-package-broker/src/executor/windows/privileges.rs Coordinates process privileges.
crates/now-package-broker/src/executor/windows/token.rs Resolves sessions and tokens.
crates/now-package-broker/src/evaluator/mod.rs Coordinates policy evaluation.
crates/now-package-broker/src/evaluator/constraints.rs Applies policy constraints.
crates/now-package-broker/src/evaluator/matching.rs Matches requests against rules.
crates/now-package-broker/src/evaluator/tests.rs Tests policy decisions.
crates/now-package-broker/src/evaluator/version.rs Matches semantic versions.
crates/now-package-broker/src/evaluator/wildcard.rs Matches wildcard patterns.
crates/now-package-broker/src/command_builder/mod.rs Dispatches package-manager builders.
crates/now-package-broker/src/command_builder/bun.rs Builds Bun commands.
crates/now-package-broker/src/command_builder/cargo.rs Builds Cargo commands.
crates/now-package-broker/src/command_builder/chocolatey.rs Builds Chocolatey commands.
crates/now-package-broker/src/command_builder/dotnet.rs Builds .NET tool commands.
crates/now-package-broker/src/command_builder/npm.rs Builds npm commands.
crates/now-package-broker/src/command_builder/pip.rs Builds pip commands.
crates/now-package-broker/src/command_builder/powershell.rs Builds PowerShell package commands.
crates/now-package-broker/src/command_builder/scoop.rs Builds Scoop commands.
crates/now-package-broker/src/command_builder/vcpkg.rs Builds vcpkg commands.
crates/now-package-broker/src/command_builder/winget.rs Builds WinGet commands.
crates/now-package-broker/src/assets/samples/scenarios/baseline.scenarios.json Adds baseline scenarios.
crates/now-package-broker/src/assets/samples/requests/winget-vscode-install.request.json Adds an allowed request sample.
crates/now-package-broker/src/assets/samples/requests/winget-vscode-skiphash.request.json Adds a risky-option sample.
crates/now-package-broker/src/assets/samples/requests/winget-unknown-install.request.json Adds an unapproved-package sample.
crates/now-package-broker/src/assets/samples/corporate-allowlist.policy.json Adds an allow-list policy sample.
crates/now-package-broker/src/assets/samples/deny-risky-options.policy.json Adds a risky-option policy sample.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

hyper-util = { version = "0.1", features = ["tokio", "server", "server-auto", "service"] }
notify = { version = "7", default-features = false }
now-policy = "0.2"
now-policy-api = { version = "0.3", features = ["policy-compat"] }
The hostname suggestion list did not set its own text colour, so options
were painted with whatever colour the PrimeNG theme supplied. When that
colour was close to the panel background the suggestions were invisible
until the pointer moved over them.

The styles meant to prevent this had been written against PrimeNG 18
class names and stopped matching anything when the app moved to PrimeNG
20. They are now ported to the current class names and the suggestion
list is themed like every other dropdown, so options stay readable in
both light and dark themes.

Issue: DGW-337

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The step was hardcoded to gateway-client, so the four other packages
published by this workflow were never pulled into npm-remote-cache and
consumers got a 403 on their first install.
Support the explicit VMConnect RDCleanPath shape from
Devolutions/IronRDP#1505.

Generic PCBs keep the ordinary X.224-first path. VMConnect requests
carry a Unicode payload with no X.224; Gateway encodes the binary PCB,
writes it before TLS (bounded by the MS-RDPEPS 10s deadline), then
leaves CredSSP and X.224 to the client. Credential injection is rejected
for this ordering.

Depends-on: Devolutions/IronRDP#1505

Issue: Devolutions/IronRDP#1505

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Bumps [openssl-probe](https://github.com/rustls/openssl-probe) from
0.1.6 to 0.2.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/rustls/openssl-probe/releases">openssl-probe's
releases</a>.</em></p>
<blockquote>
<h2>0.2.1</h2>
<ul>
<li>Support for OpenHarmony.</li>
<li>Corrections to crate metadata.</li>
</ul>
<h2>What's Changed</h2>
<ul>
<li>feat: add openharmony platform preset certs folder by <a
href="https://github.com/richerfu"><code>@​richerfu</code></a> in <a
href="https://redirect.github.com/rustls/openssl-probe/pull/42">rustls/openssl-probe#42</a></li>
<li>docs: clarify lib description, update README by <a
href="https://github.com/cpu"><code>@​cpu</code></a> in <a
href="https://redirect.github.com/rustls/openssl-probe/pull/47">rustls/openssl-probe#47</a></li>
<li>Prepare 0.2.1 by <a
href="https://github.com/ctz"><code>@​ctz</code></a> in <a
href="https://redirect.github.com/rustls/openssl-probe/pull/46">rustls/openssl-probe#46</a></li>
</ul>
<p>0.2.0 is the first release after openssl-probe maintenance has been
handed over to the rustls team. Thanks to <a
href="https://github.com/alexcrichton"><code>@​alexcrichton</code></a>
for creating and maintaining it for the past 9 years. We're happy to
address any feedback you have for this crate.</p>
<h2>Breaking changes</h2>
<ul>
<li><code>ProbeResult::cert_dir</code> is now a
<code>Vec&lt;PathBuf&gt;</code> rather than an
<code>Option&lt;PathBuf&gt;</code>, allowing the library to yield
multiple suggestions for directories which may contain certificate
files.</li>
<li>Rather than using a single list of locations for certificate files
and certificate directories, openssl-probe now uses much shorter
per-platform lists. This should make the API faster and make it less
likely to accidentally pick up locations that are unidiomatic for the
platform.</li>
<li>Removed deprecated API</li>
</ul>
<h2>What's Changed</h2>
<ul>
<li>Clean up deprecated API, module structure by <a
href="https://github.com/djc"><code>@​djc</code></a> in <a
href="https://redirect.github.com/rustls/openssl-probe/pull/40">rustls/openssl-probe#40</a></li>
<li>Per-platform candidates, multiple directories by <a
href="https://github.com/djc"><code>@​djc</code></a> in <a
href="https://redirect.github.com/rustls/openssl-probe/pull/41">rustls/openssl-probe#41</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/rustls/openssl-probe/commit/9181752ff5eab32339111dbdcc6cdc9f5a5eb06e"><code>9181752</code></a>
Prepare 0.2.1</li>
<li><a
href="https://github.com/rustls/openssl-probe/commit/2a23322fcd331d00cf109eb5ced0e90736f628f2"><code>2a23322</code></a>
docs: clarify lib description, update README</li>
<li><a
href="https://github.com/rustls/openssl-probe/commit/5e18d538b7fd1b8317f07ed8d99976676be9a915"><code>5e18d53</code></a>
feat: add openharmony platform preset certs folder</li>
<li><a
href="https://github.com/rustls/openssl-probe/commit/df769f449bf942b20de5e39facdd5135657b662d"><code>df769f4</code></a>
Update repo URL in Cargo metadata</li>
<li><a
href="https://github.com/rustls/openssl-probe/commit/cc52ac707bf6e8d2d62292ffdca3b2f03c4a6cc1"><code>cc52ac7</code></a>
ci: check cargo-deny (and fix up SPDX metadata)</li>
<li><a
href="https://github.com/rustls/openssl-probe/commit/4cfa0952d67031604a0f1e975d22707dc553ca4e"><code>4cfa095</code></a>
ci: check semver compatibility</li>
<li><a
href="https://github.com/rustls/openssl-probe/commit/04e7058a36320c0e19f2ad525b1859a8d597dbe5"><code>04e7058</code></a>
ci: check clippy</li>
<li><a
href="https://github.com/rustls/openssl-probe/commit/fbce3247f81d8a63f0b5a3966acde5e8abbb9d25"><code>fbce324</code></a>
ci: check code formatting</li>
<li><a
href="https://github.com/rustls/openssl-probe/commit/11fba1bdf7d81d11a1879ba12be6d96e9dddf599"><code>11fba1b</code></a>
ci: setup duplicate workflow cancellation</li>
<li><a
href="https://github.com/rustls/openssl-probe/commit/a44b6f114a837e229450f40a299894bfc682e0c4"><code>a44b6f1</code></a>
ci: restrict workflow permissions</li>
<li>Additional commits viewable in <a
href="https://github.com/rustls/openssl-probe/compare/0.1.6...0.2.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=openssl-probe&package-manager=cargo&previous-version=0.1.6&new-version=0.2.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
The pstools Chocolatey package downloads PSTools.zip from Microsoft at
install time and pins a checksum that breaks whenever Microsoft updates
the zip; the latest package version currently fails this way and breaks
the PEDM simulator CI job, while older versions skip verification
entirely. Download PSTools.zip directly from Microsoft and verify it
against a checksum pinned in the workflow, so installs stay
integrity-checked and the hash is bumped deliberately when Microsoft
publishes a new PSTools.

---------

Co-authored-by: Vladyslav Nikonov <mail@pacmancoder.xyz>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Move the package broker subsystem out of the devolutions-agent binary
into a new crates/now-package-broker crate, keeping the agent manifest
lean and giving the broker-only dependency set (axum, hyper-util,
notify, now-policy, ...) its own home. The crate compiles to an empty
library on non-Windows platforms.

Extract code_signing into devolutions-agent-shared so it is shared
between the updater and the broker, which previously reached back into
the agent crate for it. The agent forwards the development-only
dev-skip-broker-signature feature to the broker crate.

Issue: DGW-417

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…-devolutions-dgw-417-extract-package-broker-crate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants